package cn.et.food.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import cn.et.food.entity.Food;

public interface FoodMapper {

	@Select("select * from food where foodid = #{0}")
	public Food queryFoodById(String foodId);
	
	@Select("select * from food where foodName like '%${foodName}%'")
	public List<Food> queryFoodsByName(@Param("foodName") String foodName);
	
	@Delete("delete from food where foodid = #{0}")
	public void deleteFoodById(String foodId);
	
	@Update("update food set foodName = #{1} , price = #{2} where foodid = #{0}")
	public void updateFood(String foodId, String foodName , String price);
	
	@Insert("INSERT INTO food (foodname , price) VALUES (#{0} , ${price})")
	public void saveFood(String foodName , @Param("price") String price);
}
